﻿@model IEnumerable<Manager.Model.Admin.M_AdminRole>

@{
    ViewBag.Title = "角色管理";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@section header{
    <style type="text/css">
    .gridColCheck{width:10%;}
    </style>
    <script type="text/javascript">
        $(function () {
            $("input[type='radio']").each(function () {
                $(this).click(function () {
                    $("#btnEdit").attr("href","/Admin/Role/Edit/" + $(this).attr("value"));
                    $("#btnDel").attr("href", "/Admin/Role/Del/" + $(this).attr("value"));
                    $("#btnRole").attr("href", "/Admin/Role/Role/" + $(this).attr("value"));
                });
            });
        });
        function cusval() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return true;
            }
        }
        function cusDel() {
            var slt = $("input[type='radio']:checked").val();
            if (!slt) {
                alert("请选择要操作的数据！");
                return false;
            } else {
                return confirm('你确定要删除么？');
            }
        }
    </script>
}
<div class="nav">当前位置 :-> 角色设置</div>
<div class="toolbar">
    @Html.ActionLink("添加","Add", "Role", new { area="Admin"},null)
    @Html.ActionLink("编辑", "Edit", "Role", new { area = "Admin" }, new { @id = "btnEdit",onclick="return cusval()" })
    @Html.ActionLink("删除", "Del", "Role", new { area = "Admin" }, new { @id = "btnDel", onclick = "return cusDel()" })
    @Html.ActionLink("权限", "Role", "Role", new { area = "Admin" }, new { @id = "btnRole", onclick = "return cusval()" })
    @Html.ActionLink("刷新","Index", "Role", new { area="Admin"},null)
</div>
<hr />
@{var grid = new WebGrid(source:Model,defaultSort:"RoleID",rowsPerPage:10);}

@grid.GetHtml(
tableStyle: "grid",
headerStyle: "head",
alternatingRowStyle: "alt",
htmlAttributes: new { width = "100%" },
columns: grid.Columns(
grid.Column(format: @<text><input type="radio" name="rdoRole" value="@item.RoleID" /></text>),
    grid.Column("RoleID", "编号"),
    grid.Column("RoleName", "角色名称"),
        grid.Column("RoleDesc", "角色描述")
)
)

